import Cookies from 'js-cookie'

const app={
    state:{
        sidebar:{
            opened:!+Cookies.get('sidebarStatus')
        }
    },
    motations:{
        TOGGLE_SIDEBAR:state=>{
            if(state.sidebar.opened){
                Cookies.set('sidebarStatus',1)
            }else{
                Cookies.set('sidebarStatus',1)
            }
            state.sidebar.opened=!state.sidebar.opened
        }
    },
    actions:{
        ToggleSideBar({commit}){
            commit(TOGGLE_SIDEBAR)
        }
    }
}

export default app;